Stream Keys
Here is a breakdown of the new stream key API and how to use it. (Note: This page is a work in progress). Stream Key Explanation A stream key is generated from within the game settings in the Settings > Game > Stream Key section. A player can use their 64-bit Steam ID, with the in-game Stream Key, to generate a URL allowing access to the API. The URL takes the following form: https://tb-api.xyz/stream/get?s=[your SteamID64]&key=stream key When a player has started playing with the stream key enabled, the page accessed with the URL will display a JSON string with a format similar to the one below: { "current": { "char": 2, "lasthit": 15, "world": 3, "level": 1, "crown": 1, "wepA": 4, "wepB": 20, "skin": 0, "ultra": 0, "charlvl": 4, "loops": 0, "win": false, "mutations": "00000000000000000000010100010", "kills": 86, "health": 1, "steamid": 76561198054979849, "type": "normal", "timestamp": 1453917332 }, "previous": null } Sections of the Stream Key The stream key is a JSON file with multiple fields, each containing a value corresponding to the status of the player during the most recent update. An example JSON string is shown below. Current / Previous If the run is noted as "current", this means it's currently in progress. If it's noted as "previous", it means it has ended and will no longer be updated. When a run ends, it gets moved from "current" to "previous", and the former "previous" run gets removed. If there are no available runs, the value will be "null" like in the example above. Runs automatically expire 30 minutes after not being updated. Health The current health total of the player. "health": B-Skin Indicates if the player is currently using a B-Skin. "skin": 0 or "skin": 1 Character Indicates the current character being played. The characters are displayed as numbers from 1 to 15, not including 13. The last two are the secret characters. Mutations Indicates the current mutations chosen by the player. The player's mutation status is held in a 29-bit binary number, with each bit representing one mutation. A bit set to '1' indicates that the player has that mutation. A bit set to '0' indicates that the player does not have that mutation. '' ''The JSON is in the following format: "mutations":"00001000000000000010000001000" The mutations are as follows (with bit positions relative to the first position): Area The current area of the player. The JSON is in the following format: "level":1 The area numbers are the same as they appear in game (1-1, 1-2, 1-3, etc.). Secret areas and the crown vault seem to be different. Secret levels have an area of 1. Crown vaults have different areas. The Scrapyard Crown Vault has an area of 3, the Frozen City Crown Vault has an area of 2. (More testing is required) Learn more about the secret levels and loop levels (Campfire/HQ), as well as crown vaults Crown Indicates the current crown of the player. World The current world of the player. The JSON is in the following format: "world":2 The world numbers are the same as they appear in game (World 1 being the Desert, World 2 being the Sewers, etc.), with the exception of the secret levels. Complete list of worlds Loop Indicates the current loop number. The JSON is in the following format: "loops":0 Weapons Uses two fields to indicate the current weapons held by the player. The JSON is in the following format: "wep1":17, "wep2":5 The weapon IDs are as follows: Timestamp Set to the UNIX timestamp of the time when you started your run. "timestamp":1454012759 Kills Indicates the number of enemies that the player has killed. The JSON is in the following format: "kills":158 Type This field indicates what is the type of the run. The JSON is in the following format: "type": "normal" The following values are possible: "normal", "daily", "weekly" and "hard". Ultra This field indicates the ultra mutation of the player. '' "ultra" : 0 No ultra mutation "ultra" : 1 or 2 Which ultra mutation was picked (from left to right). Lasthit ''This field indicates the ID of the last enemy that hit the player. (If the player's health is 0, then this would indicate what they died to.) The JSON is in the following format: "lasthit":7 The enemy IDs are as follows: